package com.joysuch.wwyt.patrol.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @author zero
 * @since 2022/2/28 18:08
 */
public enum CycleType {
    CYCLE("cycle","按照固定周期"),
    SINGLE("single","单次临时"),
    SPECIFY("specify","指定次数")
    ;

    private String value;
    
    private String desc;

    CycleType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<String, CycleType> lookup = new HashMap<>();

    static {
        for (CycleType e : EnumSet.allOf(CycleType.class)) {
            lookup.put(e.value, e);
        }
    }

    public static CycleType find(String  value) {
        return lookup.get(value);
    }
}
